<!doctype html>
<html lang="zh-CN">

<head>
  <meta charset="<?php echo $cfg_soft_lang; ?>">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <script src="<?php echo $cfg_cmsurl;?>/static/js/jquery.min.js"></script>
  <link rel="stylesheet" href="<?php echo $cfg_cmsurl;?>/static/css/bootstrap.min.css">
  <link href="<?php echo $cfg_cmsurl;?>/static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  <link rel="stylesheet" href="<?php echo $cfg_cmsurl;?>/static/css/dede.css">
  <link rel="stylesheet" href="<?php echo $cfg_cmsurl;?>/static/css/member.css">
  <title>编辑软件:<?php echo $row['title']?> - 会员中心 - <?php echo $cfg_webname; ?></title>
  <script type="text/javascript">
    var startNum = 2;
    function MakeUpload() {
      var upfield = document.getElementById("uploadfield");
      var morelinkobj = document.getElementById("morelink");
      var endNum = parseInt(document.addcontent.picnum.value) + startNum - 1;
      morelinkobj.style.display = "block";
      if (endNum > 12) endNum = 12;
      for (startNum; startNum <= endNum; startNum++) {

        upfield.innerHTML += "<label>软件地址" + startNum + "：</label><input type='text' name='softurl" + startNum + "' value='http://' maxlength='100' class='form-control'> ";
        upfield.innerHTML += " ";
        upfield.innerHTML += "服务器名称：<input type='text' name='servermsg" + startNum + "' class='form-control'>\r\n";

      }
    }

    function ShowHideAddr() {
      document.getElementById('morelink').style.display = (document.getElementById('morelink').style.display == 'block' ? 'none' : 'block');
      document.getElementById('btsh3').value = (document.getElementById('morelink').style.display == 'block' ? '隐藏地址' : '显示地址');
    }
  </script>
</head>

<body>
  <?php include(DEDEMEMBER."/templets/top_login.htm"); ?>

  <main class="member">
    <div class="container-fluid pannel">
      <div class="container">
        <div class="row">
          <div class="pannel-main col-md-12 mt-3 mb-3">
            <div class="pannel-main-container">
              <nav class="navbar navbar-expand-lg">
                <ol class="breadcrumb mb-0 mr-auto">
                  <li class="breadcrumb-item"><a href="<?php echo $cfg_memberurl;?>/">会员中心</a></li>
                  <li class="breadcrumb-item">编辑软件:<?php echo $row['title']?></li>
                  </li>
                </ol>
                <span class="navbar-text">
                  <a href="javascript:history.back(-1);" class="btn btn-sm">返回</a>
                </span>
              </nav>
              <form name="addcontent" action="soft_edit.php" method="post" enctype="multipart/form-data"
                onsubmit="return checkSubmit();">
                <input type="hidden" name="dopost" value="save" />
                <input type="hidden" name="aid" value="<?php echo $row['id']; ?>" />
                <input type="hidden" name="channelid" value="<?php echo $row['channel']; ?>" />
                <input type="hidden" name="oldlitpic" value="<?php echo $row['litpic']; ?>" />
                <input type="hidden" name="sortrank" value="<?php echo $row['sortrank']; ?>" />
                <div id="mainCp">
                  <div class="form-group row">
                    <label class="col-sm-2 col-form-label"><?php echo $cInfos['typename']; ?>名称</label>
                    <div class="col-sm-10">
                      <input name="title" type="text" id="title" value="<?php echo $row['title']?>" class="form-control" placeholder="请输入内容主题" />
                    </div>
                  </div>
                  <div class="form-group row">
                    <label class="col-sm-2 col-form-label">标签Tag</label>
                    <div class="col-sm-10">
                      <input name="tags" type="text" value="<?php echo GetTags($row['id']); ?>" id="tags" class="form-control" />
                    </div>
                  </div>
                  <div class="form-group row">
                    <label class="col-sm-2 col-form-label">作者</label>
                    <div class="col-sm-10">
                      <input name="writer" type="text" id="writer" value="<?php echo $cfg_ml->M_UserName?>"
                        class="form-control" />
                    </div>
                  </div>
                  <div class="form-group row">
                    <label class="col-sm-2 col-form-label">隶属栏目</label>
                    <div class="col-sm-10">
                      <?php
                        $typeOptions = GetOptionList($row["typeid"],$row["channel"]);
                        echo "<select class='form-control' name='typeid' size='1'>\r\n";
                        echo $typeOptions;
                        echo "</select>";
                      ?>
                      <span style="color:#F00">*</span>(不能选择带颜色的分类)
                    </div>
                  </div>

                  <div class="form-row">
                    <div class="form-group col-md-6">
                      <label for="filetype">文件类型</label>
                      <select name="filetype" id="filetype" class='form-control'>
                        <?php
                          if($addRow["filetype"]!="") echo "<option value=\"".$addRow["filetype"]."\" selected>".$addRow["filetype"]."</option>\r\n";
                        ?>
                        <option value=".exe">.exe</option>
                        <option value=".zip">.zip</option>
                        <option value=".rar">.rar</option>
                        <option value=".iso">.iso</option>
                        <option value=".gz">.gz</option>
                        <option value="其它">其它</option>
                      </select>
                    </div>
                    <div class="form-group col-md-6">
                      <label for="language">界面语言</label>
                      <select name="language" id="language" class='form-control'>
                        <?php
                          if($addRow["language"]!="") echo "<option value=\"".$addRow["language"]."\" selected>".$addRow["language"]."</option>\r\n";
                        ?>
                        <option value="简体中文">简体中文</option>
                        <option value="英文软件">英文软件</option>
                        <option value="繁体中文">繁体中文</option>
                        <option value="其它类型">其它类型</option>
                      </select>
                    </div>
                  </div>

                  <div class="form-row">
                    <div class="form-group col-md-6">
                      <label for="softtype">软件类型</label>
                      <select name="softtype" id="softtype" class='form-control'>
                        <?php
      					          if($addRow["softtype"]!="") echo "<option value=\"".$addRow["softtype"]."\" selected>".$addRow["softtype"]."</option>\r\n";
               		      ?>
                        <option value="国产软件" selected="selected">国产软件</option>
                        <option value="国外软件">国外软件</option>
                        <option value="汉化补丁">汉化补丁</option>
                      </select>
                    </div>
                    <div class="form-group col-md-6">
                      <label for="accredit">授权方式</label>
                      <select name="accredit" id="accredit" class='form-control'>
                        <?php
                          if($addRow["accredit"]!="") echo "<option value=\"".$addRow["accredit"]."\" selected>".$addRow["accredit"]."</option>\r\n";
                        ?>
                        <option value="共享软件">共享软件</option>
                        <option value="免费软件">免费软件</option>
                        <option value="开源软件">开源软件</option>
                        <option value="商业软件">商业软件</option>
                        <option value="破解软件">破解软件</option>
                        <option value="游戏外挂">游戏外挂</option>
                      </select>
                    </div>
                  </div>

                  <div class="form-row">
                    <div class="form-group col-md-6">
                      <label for="os">运行环境</label>
                      <input type='text' id="os" name='os' value="<?php echo isset($addRow['os'])? $addRow['os'] : ''; ?>" maxlength="100"
                        class='form-control' />
                    </div>
                    <div class="form-group col-md-6">
                      <label for="softrank">软件等级</label>
                      <select name="softrank" id="softrank" class='form-control'>
                        <?php
                          if($addRow["softrank"]!="") echo "<option value=\"".$addRow["softrank"]."\" selected>".$addRow["softrank"]."星</option>\r\n";
                        ?>
                        <option value="1">一星</option>
                        <option value="2">二星</option>
                        <option value="3">三星 </option>
                        <option value="4">四星</option>
                        <option value="5">五星</option>
                      </select>
                    </div>
                  </div>

                  <div class="form-row">
                    <div class="form-group col-md-6">
                      <label for="officialDemo">官方网址</label>
                      <input type="text" name="officialDemo" value="<?php echo isset($addRow['officialUrl'])? $addRow['officialUrl'] : ''; ?>" id="officialDemo" maxlength="100" class='form-control' />
                    </div>
                    <div class="form-group col-md-6">
                      <label for="officialUrl">程序演示</label>
                      <input type="text" value="<?php echo isset($addRow['officialDemo'])? $addRow['officialDemo'] : ''; ?>"  name="officialUrl" id="officialUrl" value="http://" maxlength="100"
                        class='form-control' />
                    </div>
                  </div>
                  <div class="form-row">
                    <div class="form-group col-md-6">
                      <label for="softsize">软件大小</label>
                      <div class="input-group ">
                        <input type="text" name="softsize" id="softsize"  value="<?php echo isset($addRow['softsize'])? $addRow['softsize'] : ''; ?>" maxlength="100" class='form-control' />
                      </div>
                    </div>
                    <div class="form-group col-md-6">
                      <label for="source">软件来源</label>
                      <input name="source" type="text" id="source"  value="<?php echo $row['source'] ?>" maxlength="100" class='form-control' />
                    </div>
                  </div>
                  <?php
                    //自定义字段
                    PrintAutoFieldsEdit($cInfos['fieldset'],$addRow,'autofield');
                  ?>
                  <!-- 表单操作区域 -->
                  <div class="contentShow postForm">
                    <p>
                      <label>文字介绍：</label>
                      <?php 
                      $addRow["introduce"] = isset($addRow["introduce"])? $addRow["introduce"] : '';
                      GetEditor("body",$addRow["introduce"],250,"Small");
                      ?>
                    </p>
                    <p class="cellBg">
                      <label>下载地址：</label>
                      <input name="softurl1" type="text" id="softurl1" class='form-control' />
                      服务器名称：
                      <input name="servermsg1" type="text" id="servermsg1" value="下载" class='form-control' />
                    </p>
                    <p>
                      <label>其它地址：</label>
                      <input name="picnum" type="text" id="picnum" value="5" size="8" class='form-control' />
                      <button name='kkkup' type='button' id='kkkup2' onclick="MakeUpload();" class="btn btn-success btn-sm">增加地址</button>
                      <button type="button" name="Submit3" id="btsh3" onclick="ShowHideAddr();"
                        class="btn btn-success btn-sm">隐藏地址</button>
                      (最多为12个链接)</p>
                      <div id="morelink" class="mt10">
                        <?php
                    echo $nForm;
                    echo "<span id='uploadfield'></span>";
                  ?>
                      </div>
                    <?php
              //游客强制加验证码，会员则判断后台开关
              if(preg_match("/3/",$safe_gdopen)){
            ?>
                    <div class="form-group row">
                      <label class="col-sm-2 col-form-label">验证码</label>
                      <div class="col-sm-10">
                        <input name="vdcode" type="text" id="vdcode" maxlength="100" class="intxt"
                          style='width:100px;text-transform:uppercase;' />
                        <img src="../plus/vdimgck.php" alt="看不清？点击更换" align="absmiddle" style="cursor:pointer"
                          onclick="this.src=this.src+'?'" />
                      </div>
                    </div>
                    <?php }?>
                    <p>
                      <button class="btn btn-success" type="submit">提交</button>
                      <button class="btn btn-secondary" type="reset" onclick="location.reload();">重置</button>
                    </p>
                  </div>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
  </main>
  <?php include(DEDEMEMBER."/templets/footer.htm"); ?>
  <script type="text/javascript">
    function checkSubmit() {
      if (document.addcontent.title.value == "") {
        ShowMsg("名称不能为空！");
        document.addcontent.title.focus();
        return false;
      }

      if (document.addcontent.typeid.value == 0) {
        ShowMsg("隶属栏目必须选择！");
        return false;
      }

      if (document.addcontent.typeid.options && document.addcontent.typeid.options[document.addcontent.typeid.selectedIndex].className != 'option3') {
        ShowMsg("隶属栏目必须选择白色背景的项目！");
        return false;
      }

      if (document.addcontent.vdcode.value == "") {
        document.addcontent.vdcode.focus();
        ShowMsg("验证码不能为空！");
        return false;
      }
    }
  </script>
</body>

</html>